PUB NES_Read_Gamepad : nes_bits   |       i

'This is intended as a replacement for code which contain
'an embedded NES_Read_Gamepad function.  Simple overwrite
'the entire 'PUB NES_Read_Gamepad' with the contents of this file.

'Adjust remarked entries as required.
'This is designed for the adapter: 'atari_vga_schematic.jpg"

  if ina[16] == 1 & nes_bits == 0 'Read Fire alternate between Select & Start
     nes_bits := %00000000_00010000
  elseif ina[16] == 1 & nes_bits == %00000000_00100000
     nes_bits := %00000000_00010000
  elseif ina[16] == 1 & nes_bits == %00000000_00010000
     nes_bits := %00000000_00100000

  if ina[17] == 1 'Read RIGHT show as NES_DPAD Right
     nes_bits := %00000000_00000001

  if ina[19] == 1 'Read LEFT  show as NES0_DPAD Left
     nes_bits := %00000000_00000010

  if ina[21] == 1 'Read DOWN  show as NES0_B button
     nes_bits := %00000000_01000000

'  if ina[21] == 1 'Read Down  show as NES0_DPAD down
'     nes_bits := %00000000_00000100 

  if ina[23] == 1 'Read UP    show as NES0_A button
     nes_bits := %00000000_10000000

'  if ina[23] == 1 'Read UP    show as NES0_DPAD up
'     nes_bits := %00000000_00001000 